<?php
require_once 'dbconnect.php';
$tb_name="Executives";

$uname=$_POST["name"];
//echo "usename ".$uname;
$mypwd=$_POST["pwd"];

$sql="SELECT * FROM $tb_name WHERE exe_name='$uname' AND pwd='$mypwd'";

$data=mysql_query($sql) or die('query failed to execute'.mysql_error());

$count=mysql_num_rows($data);

$usr='';
$pass='';


while($line = mysql_fetch_assoc($data))
{
 
$usr=$line['exe_name'];
$pass=$line['pwd'];


}

if($count>=1){

session_start();
$_SESSION['user']=$usr;

header("location:index.php");


}else{

$msg="wrong username or password";
header("location:login.php?loginmsg=".$msg);

}
mysql_close($con);

?>
